package com.woniuxy.micromedicalserver.hospitalmanage.controller;




import com.woniuxy.micromedicalserver.bean.HospitalTypeBean;
import com.woniuxy.micromedicalserver.bean.ResultMsg;
import com.woniuxy.micromedicalserver.hospitalmanage.service.IHospitalTypeService;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RequestMapping("/hospital")
@RestController
public class HospitalTypeController {

    @Resource
    private IHospitalTypeService hospitalTypeServiceImpl;


    @GetMapping(value = "/type", produces = MediaType.APPLICATION_JSON_VALUE)
    public ResultMsg getAllHospitalType(){
            List<HospitalTypeBean> list = hospitalTypeServiceImpl.selectAll();
            return new ResultMsg(true,list);
    }

    @GetMapping(value = "/type/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
    public ResultMsg getHospitalTypeByID(@PathVariable("id") Integer ID){
            HospitalTypeBean hospitalTypeBean = hospitalTypeServiceImpl.selectByID(ID);
            return new ResultMsg(true,hospitalTypeBean);
    }







}
